import request from '@/utils/request'

// 查询学科研究方向列表
export function listResearchDirection(query) {
  return request({
    url: '/college/researchDirection/list',
    method: 'get',
    params: query
  })
}

// 查询学科研究方向详细
export function getResearchDirection(id) {
  return request({
    url: '/college/researchDirection/' + id,
    method: 'get'
  })
}

// 新增学科研究方向
export function addResearchDirection(data) {
  return request({
    url: '/college/researchDirection',
    method: 'post',
    data: data
  })
}

// 修改学科研究方向
export function updateResearchDirection(data) {
  return request({
    url: '/college/researchDirection',
    method: 'put',
    data: data
  })
}

// 删除学科研究方向
export function delResearchDirection(id) {
  return request({
    url: '/college/researchDirection/' + id,
    method: 'delete'
  })
}

// 根据学院id查询学科方向
export function getResearchDirectionByCollegeId(collegeCode) {
  return request({
    url: `/college/researchDirection/getResearchDirectionByCollegeId/${collegeCode}`,
    method: 'get'
  })
}

//根据培养方案ID获取对应的学科信息（包含一级学科、二级学科、研究方向名称）
export function getSubjectIdListByProgramId(programId) {
  return request({
    url: `/college/researchDirection/getSubjectIdListByProgramId/${programId}`, // 与后端接口路径对应
    method: 'get' // 后端是GET请求，保持一致
  })
}
